[IA64] Handle VTi's fp fault & trap in hypervisor instead of injecting to guest
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Sat, 3 Jun 2006 21:34:07 +0000 (15:34 -0600)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Sat, 3 Jun 2006 21:34:07 +0000 (15:34 -0600)
Signed-off-by : Zhang xiantao <xiantao.zhang@intel.com>
Signed-off-by : Kevin Tian    <kevin.tian@intel.com>

xen/arch/ia64/vmx/vmx_process.c
xen/arch/ia64/xen/process.c

index b86bee57ef30fa4a071ef901dc768b4515633838..c6e4d0220cd320494eeaa1dc00077642a0aa12ec 100644 (file)
@@ -62,6 +62,7 @@ extern unsigned long translate_domain_mpaddr(unsigned long mpaddr);
 extern void alt_itlb (VCPU *vcpu, u64 vadr);
 extern void itlb_fault (VCPU *vcpu, u64 vadr);
 extern void ivhpt_fault (VCPU *vcpu, u64 vadr);
+extern unsigned long handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr);
 
 #define DOMN_PAL_REQUEST    0x110000
 #define DOMN_SAL_REQUEST    0x110001
@@ -84,9 +85,20 @@ void vmx_reflect_interruption(UINT64 ifa,UINT64 isr,UINT64 iim,
     VCPU *vcpu = current;
     UINT64 vpsr = vmx_vcpu_get_psr(vcpu);
     vector=vec2off[vector];
-    if(!(vpsr&IA64_PSR_IC)&&(vector!=0x1400)){
+    if(!(vpsr&IA64_PSR_IC)&&(vector!=IA64_DATA_NESTED_TLB_VECTOR)){
         panic_domain(regs, "Guest nested fault vector=%lx!\n", vector);
     }
+    else{ // handle fpswa emulation
+        // fp fault
+        if(vector == IA64_FP_FAULT_VECTOR && !handle_fpu_swa(1, regs, isr)){
+            vmx_vcpu_increment_iip(vcpu);
+            return;
+        }
+        //fp trap
+        else if(vector == IA64_FP_TRAP_VECTOR && !handle_fpu_swa(0, regs, isr)){
+            return; 
+        }
+    }
     VCPU(vcpu,isr)=isr;
     VCPU(vcpu,iipa) = regs->cr_iip;
     if (vector == IA64_BREAK_VECTOR || vector == IA64_SPECULATION_VECTOR)
index dc24f065d7eeeba3edc96fe6b9fffdef26c3af70..631b5fc2091236beed91cb52a816936304b64f49 100644 (file)
@@ -447,7 +447,7 @@ fp_emulate (int fp_fault, void *bundle, unsigned long *ipsr,
 /*
  * Handle floating-point assist faults and traps for domain.
  */
-static unsigned long
+unsigned long
 handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
 {
        struct vcpu *v = current;
@@ -477,11 +477,6 @@ handle_fpu_swa (int fp_fault, struct pt_regs *regs, unsigned long isr)
                PSCBX(v, fpswa_ret) = ret;
                printk("%s(%s): fp_emulate() returned %ld\n",
                       __FUNCTION__, fp_fault?"fault":"trap", ret.status);
-       } else {
-               if (fp_fault) {
-                       /* emulation was successful */
-                       vcpu_increment_iip(v);
-               }
        }
 
        return ret.status;
@@ -869,7 +864,10 @@ ia64_handle_reflection (unsigned long ifa, struct pt_regs *regs, unsigned long i
                // FIXME: Should we handle unaligned refs in Xen??
                vector = IA64_UNALIGNED_REF_VECTOR; break;
            case 32:
-               if (!(handle_fpu_swa(1, regs, isr))) return;
+               if (!(handle_fpu_swa(1, regs, isr))) {
+                   vcpu_increment_iip(v);
+                   return;
+               }
                printf("ia64_handle_reflection: handling FP fault\n");
                vector = IA64_FP_FAULT_VECTOR; break;
            case 33: